package com.xingzhi.shortvideosharingplatform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xingzhi.shortvideosharingplatform.model.Video;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface VideoZMapper extends BaseMapper<Video> {
    
    /**
     * 增加视频点赞数
     * @param videoId 视频ID
     * @param increment 增加的数量
     * @return 影响行数
     */
    @Update("UPDATE video SET like_count = like_count + #{increment} WHERE id = #{videoId}")
    int incrementLikeCount(@Param("videoId") Long videoId, @Param("increment") int increment);
    
    /**
     * 增加/减少视频收藏数
     * @param videoId 视频ID
     * @param increment 增加的数量（正数增加，负数减少）
     * @return 影响行数
     */
    @Update("UPDATE video SET favorite_count = favorite_count + #{increment} WHERE id = #{videoId}")
    int incrementFavoriteCount(@Param("videoId") Long videoId, @Param("increment") int increment);
} 